#include <iostream>
#include <vector>

#include "bootstrap.h"

using namespace std;

int main()
{	
	/** usage of bootstrap 
	 * 
	 * using random number as samples; computing mean as the model.
	 */
	int N=10000, n=100, b=40;
	float alpha=0.05;
	Bootstrap <int> bootstrap(N, n, b, alpha);

	vector< vector<int> > b_samples_vector;
	vector<float> b_variances;
	float bootstrap_variance	= bootstrap.do_bootstrap( &b_samples_vector, &b_variances );
	
	vector<float> upper_bound, lower_bound;
	vector<float> mean_vector = bootstrap.compute_confidence_interval(b_samples_vector, &upper_bound, &lower_bound);


	printf( "bootstrap_variance: %f, with %d b-samples and %d b-variances\n", 
						bootstrap_variance, b_samples_vector.size(), b_variances.size() );						
	
	Util _util;
//	std::sort(mean_vector.begin(), mean_vector.end());
//	printf("sorted means\n");
//	_util.print_vector(mean_vector);
	printf("upper bound\n");
	_util.print_vector(upper_bound);
	printf("lower bound\n");
	_util.print_vector(lower_bound);

	return 0;
}
